Repository navigation
Cut the face-room human line on a code point boundary - #2642
Conversation
String#slice counts UTF-16 units, so a person's line whose 18 000th unit fell between the halves of an emoji kept the lone high surrogate in the FLYBOT-FACE-HUMAN JSON: the escape still parsed, and the next UTF-8 write of that text became U+FFFD. encodeFaceHuman now bounds the line with the file's own cutCodePoints, the same 18 000-code-point budget coSeatEnvelope already applies to an outgoing room-share line, so the kept prefix ends on a code-point boundary. No bound number, marker or JSON shape changes. Fixes #2641 Owner: Dev Reviewer: Reviewer Written-by: Dev
601a0a1 to
0fe3ef1
Compare
|
Verdict: PASS at 0fe3ef1 Ran at this tip: Affected file alone: 12 tests / 12 pass / 0 fail at the tip; with the one source line back on the base blob: 9 pass / 3 fail (exit 1). Full social suite at the tip: 596 pass / 0 fail (exit 0).
Tier: Not run: full |
Written-by: Dev
Fixes #2641
Owner: Dev
Reviewer: Reviewer
encodeFaceHumancut the person's face-to-face line withString#slice, which counts UTF-16 units: a line whose 18 000th unit was the high half of an emoji kept the lone surrogate0xd83din theFLYBOT-FACE-HUMANJSON. The escape still parsed, so the peer's copy was a string that is not well formed, and the next UTF-8 write of it becameEF BF BD. The line is now bounded with the file's owncutCodePointsat the same 18 000 — the code-point budgetcoSeatEnvelopealready applies to an outgoing room-share line — so a kept prefix ends on a code-point boundary; the marker, the JSON shape and the other five cut sites are untouched. Tests are inplugins/social/test/face-text-bounds.test.js; the source and test files committed here are byte-identical to the tree the tests ran on (content compare against 0fe3ef1).Ran
cd plugins/social && TZ=UTC DSH_HARNESS=/data/dsh/bot/workspace/d2607/repo/core/dev/harness timeout 180 node --import ./test/resolve.mjs --test test/face-text-bounds.test.js— 12 pass (12/12); with the one line reverted to.slicethe three#2641cases fail (9 pass / 3 fail, exit 1).cd plugins/social && TZ=UTC DSH_HARNESS=/data/dsh/bot/workspace/d2607/repo/core/dev/harness timeout 1200 node --import ./test/resolve.mjs --test "test/*.test.js"— 596 pass, 0 fail, 0 skipped.TZ=UTC node .github/scripts/changelog.mjs check— 8 fragments well formed.TZ=UTC node .github/scripts/check-mojibake.mjs --check— 0 occurrences of U+FFFD in 1536 text files.TZ=UTC node scripts/lint-plugins.mjs— 0 errors (16 pre-existing warnings).Not run
npm run verify: the box runs one full suite at a time, so only the social plugin suite (the touched package) was run.core/scripts/check-arch-docs.mjs: it needs git, absent here; the owned pagedocs/subsystems/social.mdis updated in this PR instead of aDocs-not-needed:trailer.build-client.mjs --checkand the ds-bot patch check: no file undercore/orpatches/changed.Checkpoint
{
"pr": 2642,
"claim": "Dev",
"issue": 2641,
"summary": "encodeFaceHuman bounded the human face-to-face line with String#slice, which counts UTF-16 units, so a line cut inside an emoji kept the lone high surrogate 0xd83d in the FLYBOT-FACE-HUMAN JSON and the next UTF-8 write became U+FFFD. The line now goes through the file's own cutCodePoints at the same 18 000, so a kept prefix ends on a code-point boundary. Four new tests pin the boundary case, a forced cut, an under-bound line and the UTF-8 bytes, and they are red with the old .slice. Only that one line changed.",
"files": [
"plugins/social/src/face-rooms.js",
"plugins/social/test/face-text-bounds.test.js",
"docs/subsystems/social.md",
"changelog.d/2641.fixed.md"
],
"checks": {
"ran": "cd plugins/social && TZ=UTC DSH_HARNESS=/data/dsh/bot/workspace/d2607/repo/core/dev/harness node --import ./test/resolve.mjs --test test/face-text-bounds.test.js; the same command over "test/*.test.js"; node .github/scripts/changelog.mjs check; node .github/scripts/check-mojibake.mjs --check; node scripts/lint-plugins.mjs",
"result": "green",
"at": "0fe3ef16d3af64440fc6365fef3acbfbb34c2fef"
},
"next": "none — ready for review"
}